{% from "cms/cms_macro.html" import if_active %}

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>后台管理系统</title>
    <link rel="stylesheet" href="{{url_for('static', filename='vendor/bootstrap/dist/css/bootstrap.css')}}">
    <link rel="stylesheet" href="{{ url_for('static', filename='public/css/common.css') }}">
    <link rel="stylesheet" href="{{url_for('static', filename='cms/css/cms_base.css')}}">
    <style>
        .swal-footer{
            text-align: center;
        }
    </style>
</head>
<body>

    <div class="ontainer-fluid main">
        <div class="aside">
            <div class="title">
                后台管理系统
            </div>
            <ul class="menu">
                {% with cms_user = g.cms_user %}
                    {% if cms_user.has_permission(CMSPermission.VISITOR) %}
                        <li class="menu-item {{ if_active('cms.index') }}" >
                            <a href="{{ url_for('cms.index') }}">首页</a>
                        </li>
                    {% endif %}

                    {% if cms_user.has_permission(CMSPermission.POSTER) %}
                        <li class="menu-item {{ if_active('cms.post') }}">
                            <a href="{{ url_for('cms.post') }}">帖子管理</a>
                        </li>
                    {% endif %}

                    {% if cms_user.has_permission(CMSPermission.COMMENTER) %}
                        <li class="menu-item {{ if_active('cms.comment') }}">
                            <a href="{{ url_for('cms.comment') }}">评论管理</a>
                        </li>
                    {% endif %}

                    {% if cms_user.has_permission(CMSPermission.BOARDER) %}
                        <li class="menu-item {{ if_active('cms.board') }}">
                            <a href="{{ url_for('cms.board') }}">板块管理</a>
                        </li>
                    {% endif %}

                    {% if cms_user.has_permission(CMSPermission.FRONTUSER) %}
                        <li class="menu-item {{ if_active('cms.fuser') }}">
                            <a href="{{ url_for('cms.fuser') }}">用户管理</a>
                        </li>
                    {% endif %}

                    {% if cms_user.has_permission(CMSPermission.CMSUSER) %}
                        <li class="menu-item {{ if_active('cms.cuser') }}">
                            <a href="{{ url_for('cms.cuser') }}">CMS用户管理</a>
                        </li>
                    {% endif %}

                    {% if cms_user.has_permission(CMSPermission.ADMINDER) %}
                        <li class="menu-item {{ if_active('cms.role') }}">
                            <a href="{{ url_for('cms.role') }}">CMS组管理</a>
                        </li>
                    {% endif %}

                    {% if cms_user.has_permission(CMSPermission.VISITOR) %}
                        <li class="menu-item {{ if_active('cms.profile') }}">
                            <a href="{{ url_for('cms.profile') }}">个人中心</a>
                        </li>
                        <li class="menu-item {{ if_active('cms.resetMail') }}">
                            <a href="{{ url_for('cms.resetMail') }}">重置邮箱</a>
                        </li>
                        <li class="menu-item {{ if_active('cms.modifyPwd') }}">
                            <a href="{{ url_for('cms.modifyPwd') }}">修改密码</a>
                        </li>
                    {% endif %}
                {% endwith %}
            </ul>
        </div>
        <div class="main-content">
            <nav class="navbar navbar-default">
                <div class="container-fluid">
                    <form action="" class="navbar-form navbar-left">
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="搜索">
                        </div>
                        <button class="btn btn-default">搜索</button>
                    </form>
                    <ul class="nav navbar-nav navbar-right">
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">hary <span class="caret"></span></a>
                              <ul class="dropdown-menu">
                                <li><a href="{{ url_for('cms.logout') }}">退出登录</a></li>
                              </ul>
                        </li>
                    </ul>
                </div>
            </nav>
            <div class="content">
                <h4 class="content-heading">
                    {% block title %}
                    {% endblock %}
                </h4>
                {% block content %}
                {% endblock %}
            </div>
        </div>
    </div>
    <script src="{{ url_for('static', filename='vendor/jquery/dist/jquery.js') }}"></script>
    <script src="{{ url_for('static', filename='vendor/jquery-validation/dist/jquery.validate.js') }}"></script>
    <script src="{{ url_for('static', filename='vendor/sweetalert/dist/sweetalert.min.js') }}"></script>
    <script src="{{ url_for('static', filename='sweetalert.custom.js') }}"></script>
    <script src="{{ url_for('static', filename='vendor/bootstrap/dist/js/bootstrap.js') }}"></script>
    {% block script %}
    {% endblock %}
</body>
</html>